from django.conf.urls import url
from django.contrib import admin
from rest_framework_jwt.views import obtain_jwt_token
from rest_framework.routers import DefaultRouter

from meiduo_admin.views import specs, images, statistical, users
from . import views

urlpatterns = [
    # 登录路由
    url(r'^authorizations/$', obtain_jwt_token),
    # ----------数据统计----------
    # 用户总量统计
    url(r'^statistical/total_count/$', statistical.UserCountView.as_view()),
    # 当天注册用户总量统计
    url(r'^statistical/day_increment/$', statistical.UserDayCountView.as_view()),
    # 当天登录用户总量统计
    url(r'^statistical/day_active/$', statistical.UserDayActiveCountView.as_view()),
    # 当天下单用户总量统计
    url(r'^statistical/day_orders/$', statistical.UserDayOrderCountView.as_view()),
    # 月增用户总量统计
    url(r'^statistical/month_increment/$', statistical.UserDayMonthCountView.as_view()),
    # 商品分类访问量统计
    url(r'^statistical/goods_day_views/$', statistical.GoodsCountView.as_view()),
    # ------------------用户管理------------------
    url(r'^users/$', users.UserView.as_view()),
    # ------------------商品规格表管理------------------
    url(r'^goods/simple/$', specs.SpecView.as_view({'get':'simple'})),
    # ------------------图片表管理------------------
    url(r'^skus/simple/$', images.ImageView.as_view({'get': 'simple'})),
]

# ------------------商品规格表管理------------------
router = DefaultRouter()
router.register('goods/specs', specs.SpecView, base_name='spec')
urlpatterns += router.urls
# ------------------图片表管理------------------
router = DefaultRouter()
router.register('skus/images', images.ImageView, base_name='image')
urlpatterns += router.urls